<template>

  <div>

    <h1>登录页面</h1>

    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
      <el-form-item label="用户名" prop="username">
        <el-input v-model="ruleForm.username"></el-input>
      </el-form-item>
      <el-form-item label="密码" prop="password">
        <el-input v-model="ruleForm.password"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitForm()">登录</el-button>
      </el-form-item>
    </el-form>

  </div>

</template>

<script>
export default {
  name: "LoginView",
  data(){

    return{

      ruleForm: {},
      rules: {
        username: [
          { required: true, message: '请输入用户名', trigger: 'blur' },
        ],
        password: [
          { required: true, message: '请输入密码', trigger: 'blur' },
        ],
      }

    }

  },methods : {

    login(){

      this.axios.post("http://localhost:8100/login",this.ruleForm).then(res=>{

        if(res.data.code == 200){

          this.$message.success(res.data.data);

          this.$router.push("list");

        }else{

          this.$message.error(res.data.data);

        }

      })

    }

  },created() {



  }

}
</script>

<style scoped>

</style>